﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TimerApp
{
    class Timer
    {
        private DateTime startTime;
        //private DateTime endTime;
        private TimeSpan timeCount;
        //private TimeSpan roundCount;
        private bool isWorking;
        //private bool isReset = true;

        public void Start()
        {
            if (isWorking)
            {
                Console.WriteLine("Watch out! Timer is running!");
            }
            else
            {
                Console.WriteLine("Timing Started");
                startTime = DateTime.Now;
                isWorking = true;
                //isReset = false;
            }
        }
        public void Stop()
        {

            if (!isWorking)
            {
                Console.WriteLine("Timer is stopped already! Last time is {0} select START to resume", timeCount);
            }
            else
            {
                Console.WriteLine("Timing Stoped");
                timeCount = timeCount + (DateTime.Now - startTime);
                Console.WriteLine("Timer stopped at {0} seconds", timeCount);
                isWorking = false;
            }

        }

        public void Reset()
        {
            if (isWorking)
            {
                Console.WriteLine("Stop timer first");
            }
            else
            {
                Console.Clear();
                //roundCount = TimeSpan.Zero;
                timeCount = TimeSpan.Zero;
                Console.WriteLine("Timer reseted");
                isWorking = false;
            }
        }
    }
}
